package com.hl.mapper;

import com.hl.pojo.Company;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CompanyMapper {

    @Insert("insert into company (company_name, address, phone, email, introduction) values (#{companyName}, #{address}, #{phone}, #{email}, #{introduction})")
    public Integer add(Company company);

    @Update("update company set company_name=#{companyName}, address=#{address}, phone=#{phone}, email=#{email}, introduction=#{introduction}, del=#{del} where id=#{id}")
    public Integer update(Company company);

    @Update("update  company set del = 1 where id = #{id}")
    public Integer delete(Integer id);

    @Select("select * from company where id = #{id} and del != 1")
    public Company findById(Integer id);

    @Select("select * from company where del != 1")
    public List<Company> findAll();

    @Select("select * from company")
    public List<Company> findAll1();

    @Select("select * from company c where c.company_name LIKE CONCAT('%', #{name}, '%') and del != 1")
    public List<Company> findAll2(@Param("name") String name);

}

